package com.aurora.spider.houyuantuan;

import com.geccocrawler.gecco.annotation.PipelineName;
import com.geccocrawler.gecco.pipeline.Pipeline;
import com.geccocrawler.gecco.request.HttpRequest;
import com.geccocrawler.gecco.scheduler.StartSchedulerContext;
import com.geccocrawler.gecco.spider.HrefBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * Created by jackie on 18/1/15.
 */
@PipelineName("searchDealLine")
@Component
@Slf4j
public class SearchDealLine implements Pipeline<Search> {


    @Override
    public void process(Search star) {
        //根据明显查询结果找寻关系
        HttpRequest currRequest = star.getRequest();
        for (HrefBean hrefBean : star.getNewList()) {
            String url = hrefBean.getUrl();
            StartSchedulerContext.into(currRequest.subRequest(url));
        }
    }
}
